import { IsString, ValidateIf, IsNotEmpty, IsEmail } from 'class-validator';

export class LoginUserDto {
  @ValidateIf(o => !o.email)
  @IsString({ message: '账号必须是字符串' })
  account?: string;

  @ValidateIf(o => !o.account)
  @IsEmail({}, { message: '邮箱格式不正确' })
  email?: string;

  @IsString({ message: '密码必须填写' })
  @IsNotEmpty()
  password: string;
}
